﻿using FluentValidation;

namespace Core.Identity.Tokens.Features.Refresh;

/// <summary>
/// 刷新Token
/// </summary>
/// <param name="Token">Token</param>
/// <param name="RefreshToken">刷新Token</param>
public record RefreshTokenCommand(string Token, string RefreshToken)
{
    public DateTimeOffset RefreshTokenExpiryTime { get; set; }
}

public class RefreshTokenValidator : AbstractValidator<RefreshTokenCommand>
{
    public RefreshTokenValidator()
    {
        RuleFor(p => p.Token).Cascade(CascadeMode.Stop).NotEmpty();

        RuleFor(p => p.RefreshToken).Cascade(CascadeMode.Stop).NotEmpty();
    }
}
